3.1.18 \(\int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx\) [18]

3.1.18.1 Optimal result
3.1.18.2 Mathematica [C] (verified)
3.1.18.3 Rubi [A] (verified)
3.1.18.4 Maple [A] (verified)
3.1.18.5 Fricas [A] (verification not implemented)
3.1.18.6 Sympy [F(-1)]
3.1.18.7 Maxima [A] (verification not implemented)
3.1.18.8 Giac [A] (verification not implemented)
3.1.18.9 Mupad [B] (verification not implemented)

3.1.18.1 Optimal result

Integrand size = 31, antiderivative size = 136 \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=h x-\frac {(d+f-2 h) \arctan \left (\frac {1-2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(d+f-2 h) \arctan \left (\frac {1+2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(2 e-g) \arctan \left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right ) \]

output
h*x-1/4*(d-f)*ln(x^2-x+1)+1/4*(d-f)*ln(x^2+x+1)+1/4*g*ln(x^4+x^2+1)-1/6*(d 
+f-2*h)*arctan(1/3*(1-2*x)*3^(1/2))*3^(1/2)+1/6*(d+f-2*h)*arctan(1/3*(1+2* 
x)*3^(1/2))*3^(1/2)+1/6*(2*e-g)*arctan(1/3*(2*x^2+1)*3^(1/2))*3^(1/2)
 
3.1.18.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.47 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.21 \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=\frac {1}{24} \left (24 h x+4 \left (\left (3 i+\sqrt {3}\right ) d+\left (-3 i+\sqrt {3}\right ) f-2 \sqrt {3} h\right ) \arctan \left (\frac {1}{2} \left (-i+\sqrt {3}\right ) x\right )+4 \left (\left (-3 i+\sqrt {3}\right ) d+\left (3 i+\sqrt {3}\right ) f-2 \sqrt {3} h\right ) \arctan \left (\frac {1}{2} \left (i+\sqrt {3}\right ) x\right )-8 \sqrt {3} e \arctan \left (\frac {\sqrt {3}}{1+2 x^2}\right )+4 \sqrt {3} g \arctan \left (\frac {\sqrt {3}}{1+2 x^2}\right )+6 g \log \left (1+x^2+x^4\right )\right ) \]

input
Integrate[(d + e*x + f*x^2 + g*x^3 + h*x^4)/(1 + x^2 + x^4),x]
 
output
(24*h*x + 4*((3*I + Sqrt[3])*d + (-3*I + Sqrt[3])*f - 2*Sqrt[3]*h)*ArcTan[ 
((-I + Sqrt[3])*x)/2] + 4*((-3*I + Sqrt[3])*d + (3*I + Sqrt[3])*f - 2*Sqrt 
[3]*h)*ArcTan[((I + Sqrt[3])*x)/2] - 8*Sqrt[3]*e*ArcTan[Sqrt[3]/(1 + 2*x^2 
)] + 4*Sqrt[3]*g*ArcTan[Sqrt[3]/(1 + 2*x^2)] + 6*g*Log[1 + x^2 + x^4])/24
 
3.1.18.3 Rubi [A] (verified)

Time = 0.42 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.01, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {2202, 1576, 1142, 1083, 217, 1103, 2205, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {d+e x+f x^2+g x^3+h x^4}{x^4+x^2+1} \, dx\)

\(\Big \downarrow \) 2202

\(\displaystyle \int \frac {h x^4+f x^2+d}{x^4+x^2+1}dx+\int \frac {x \left (g x^2+e\right )}{x^4+x^2+1}dx\)

\(\Big \downarrow \) 1576

\(\displaystyle \int \frac {h x^4+f x^2+d}{x^4+x^2+1}dx+\frac {1}{2} \int \frac {g x^2+e}{x^4+x^2+1}dx^2\)

\(\Big \downarrow \) 1142

\(\displaystyle \int \frac {h x^4+f x^2+d}{x^4+x^2+1}dx+\frac {1}{2} \left (\frac {1}{2} (2 e-g) \int \frac {1}{x^4+x^2+1}dx^2+\frac {1}{2} g \int \frac {2 x^2+1}{x^4+x^2+1}dx^2\right )\)

\(\Big \downarrow \) 1083

\(\displaystyle \int \frac {h x^4+f x^2+d}{x^4+x^2+1}dx+\frac {1}{2} \left (\frac {1}{2} g \int \frac {2 x^2+1}{x^4+x^2+1}dx^2-(2 e-g) \int \frac {1}{-x^4-3}d\left (2 x^2+1\right )\right )\)

\(\Big \downarrow \) 217

\(\displaystyle \frac {1}{2} \left (\frac {1}{2} g \int \frac {2 x^2+1}{x^4+x^2+1}dx^2+\frac {\arctan \left (\frac {2 x^2+1}{\sqrt {3}}\right ) (2 e-g)}{\sqrt {3}}\right )+\int \frac {h x^4+f x^2+d}{x^4+x^2+1}dx\)

\(\Big \downarrow \) 1103

\(\displaystyle \int \frac {h x^4+f x^2+d}{x^4+x^2+1}dx+\frac {1}{2} \left (\frac {\arctan \left (\frac {2 x^2+1}{\sqrt {3}}\right ) (2 e-g)}{\sqrt {3}}+\frac {1}{2} g \log \left (x^4+x^2+1\right )\right )\)

\(\Big \downarrow \) 2205

\(\displaystyle \int \left (h+\frac {(f-h) x^2+d-h}{x^4+x^2+1}\right )dx+\frac {1}{2} \left (\frac {\arctan \left (\frac {2 x^2+1}{\sqrt {3}}\right ) (2 e-g)}{\sqrt {3}}+\frac {1}{2} g \log \left (x^4+x^2+1\right )\right )\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {\arctan \left (\frac {1-2 x}{\sqrt {3}}\right ) (d+f-2 h)}{2 \sqrt {3}}+\frac {\arctan \left (\frac {2 x+1}{\sqrt {3}}\right ) (d+f-2 h)}{2 \sqrt {3}}+\frac {1}{2} \left (\frac {\arctan \left (\frac {2 x^2+1}{\sqrt {3}}\right ) (2 e-g)}{\sqrt {3}}+\frac {1}{2} g \log \left (x^4+x^2+1\right )\right )-\frac {1}{4} (d-f) \log \left (x^2-x+1\right )+\frac {1}{4} (d-f) \log \left (x^2+x+1\right )+h x\)

input
Int[(d + e*x + f*x^2 + g*x^3 + h*x^4)/(1 + x^2 + x^4),x]
 
output
h*x - ((d + f - 2*h)*ArcTan[(1 - 2*x)/Sqrt[3]])/(2*Sqrt[3]) + ((d + f - 2* 
h)*ArcTan[(1 + 2*x)/Sqrt[3]])/(2*Sqrt[3]) - ((d - f)*Log[1 - x + x^2])/4 + 
 ((d - f)*Log[1 + x + x^2])/4 + (((2*e - g)*ArcTan[(1 + 2*x^2)/Sqrt[3]])/S 
qrt[3] + (g*Log[1 + x^2 + x^4])/2)/2
 

3.1.18.3.1 Defintions of rubi rules used

rule 217
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^( 
-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] & 
& (LtQ[a, 0] || LtQ[b, 0])
 

rule 1083
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2   Subst[I 
nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, 
x]
 

rule 1103
Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> S 
imp[d*(Log[RemoveContent[a + b*x + c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, 
e}, x] && EqQ[2*c*d - b*e, 0]
 

rule 1142
Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> S 
imp[(2*c*d - b*e)/(2*c)   Int[1/(a + b*x + c*x^2), x], x] + Simp[e/(2*c) 
Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x]
 

rule 1576
Int[(x_)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^( 
p_.), x_Symbol] :> Simp[1/2   Subst[Int[(d + e*x)^q*(a + b*x + c*x^2)^p, x] 
, x, x^2], x] /; FreeQ[{a, b, c, d, e, p, q}, x]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2202
Int[(Pn_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Module[{n 
 = Expon[Pn, x], k}, Int[Sum[Coeff[Pn, x, 2*k]*x^(2*k), {k, 0, n/2}]*(a + b 
*x^2 + c*x^4)^p, x] + Int[x*Sum[Coeff[Pn, x, 2*k + 1]*x^(2*k), {k, 0, (n - 
1)/2}]*(a + b*x^2 + c*x^4)^p, x]] /; FreeQ[{a, b, c, p}, x] && PolyQ[Pn, x] 
 &&  !PolyQ[Pn, x^2]
 

rule 2205
Int[(Px_)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> Int[ExpandInte 
grand[Px/(a + b*x^2 + c*x^4), x], x] /; FreeQ[{a, b, c}, x] && PolyQ[Px, x^ 
2] && Expon[Px, x^2] > 1
 
3.1.18.4 Maple [A] (verified)

Time = 0.39 (sec) , antiderivative size = 99, normalized size of antiderivative = 0.73

method result size
default \(h x +\frac {\left (f -d +g \right ) \ln \left (x^{2}-x +1\right )}{4}+\frac {\left (\frac {d}{2}+e +\frac {f}{2}-\frac {g}{2}-h \right ) \sqrt {3}\, \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{3}+\frac {\left (d -f +g \right ) \ln \left (x^{2}+x +1\right )}{4}+\frac {\left (\frac {d}{2}-e +\frac {f}{2}+\frac {g}{2}-h \right ) \arctan \left (\frac {\left (1+2 x \right ) \sqrt {3}}{3}\right ) \sqrt {3}}{3}\) \(99\)
risch \(\text {Expression too large to display}\) \(140079\)

input
int((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x,method=_RETURNVERBOSE)
 
output
h*x+1/4*(f-d+g)*ln(x^2-x+1)+1/3*(1/2*d+e+1/2*f-1/2*g-h)*3^(1/2)*arctan(1/3 
*(2*x-1)*3^(1/2))+1/4*(d-f+g)*ln(x^2+x+1)+1/3*(1/2*d-e+1/2*f+1/2*g-h)*arct 
an(1/3*(1+2*x)*3^(1/2))*3^(1/2)
 
3.1.18.5 Fricas [A] (verification not implemented)

Time = 1.12 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.68 \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + h x + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \]

input
integrate((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="fricas")
 
output
1/6*sqrt(3)*(d - 2*e + f + g - 2*h)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sq 
rt(3)*(d + 2*e + f - g - 2*h)*arctan(1/3*sqrt(3)*(2*x - 1)) + h*x + 1/4*(d 
 - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)
 
3.1.18.6 Sympy [F(-1)]

Timed out. \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=\text {Timed out} \]

input
integrate((h*x**4+g*x**3+f*x**2+e*x+d)/(x**4+x**2+1),x)
 
output
Timed out
 
3.1.18.7 Maxima [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.68 \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + h x + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \]

input
integrate((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="maxima")
 
output
1/6*sqrt(3)*(d - 2*e + f + g - 2*h)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sq 
rt(3)*(d + 2*e + f - g - 2*h)*arctan(1/3*sqrt(3)*(2*x - 1)) + h*x + 1/4*(d 
 - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)
 
3.1.18.8 Giac [A] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.68 \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + h x + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \]

input
integrate((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="giac")
 
output
1/6*sqrt(3)*(d - 2*e + f + g - 2*h)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sq 
rt(3)*(d + 2*e + f - g - 2*h)*arctan(1/3*sqrt(3)*(2*x - 1)) + h*x + 1/4*(d 
 - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)
 
3.1.18.9 Mupad [B] (verification not implemented)

Time = 11.14 (sec) , antiderivative size = 1209, normalized size of antiderivative = 8.89 \[ \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx=\text {Too large to display} \]

input
int((d + e*x + f*x^2 + g*x^3 + h*x^4)/(x^2 + x^4 + 1),x)
 
output
log(d*f*9i - d*e*6i + d*g*3i - d*h*3i + e*h*6i + f*h*3i - g*h*3i - 3*3^(1/ 
2)*d^2 - d^2*x*6i - f^2*x*3i - d^2*3i - f^2*6i + 2*3^(1/2)*d*e + 3*3^(1/2) 
*d*f - 3^(1/2)*d*g - 4*3^(1/2)*e*f + 3*3^(1/2)*d*h + 2*3^(1/2)*e*h + 2*3^( 
1/2)*f*g - 3*3^(1/2)*f*h - 3^(1/2)*g*h + d*f*x*9i - e*f*x*6i + d*h*x*3i + 
e*h*x*6i + f*g*x*3i - f*h*x*3i - g*h*x*3i + 3*3^(1/2)*f^2*x - 3*3^(1/2)*d* 
f*x - 2*3^(1/2)*d*g*x - 2*3^(1/2)*e*f*x + 3*3^(1/2)*d*h*x - 2*3^(1/2)*e*h* 
x + 3^(1/2)*f*g*x - 3*3^(1/2)*f*h*x + 3^(1/2)*g*h*x + 4*3^(1/2)*d*e*x)*(d/ 
4 - f/4 + g/4 - (3^(1/2)*d*1i)/12 + (3^(1/2)*e*1i)/6 - (3^(1/2)*f*1i)/12 - 
 (3^(1/2)*g*1i)/12 + (3^(1/2)*h*1i)/6) - log(d*g*3i - d*f*9i - d*e*6i + d* 
h*3i + e*h*6i - f*h*3i - g*h*3i - 3*3^(1/2)*d^2 - d^2*x*6i - f^2*x*3i + d^ 
2*3i + f^2*6i - 2*3^(1/2)*d*e + 3*3^(1/2)*d*f + 3^(1/2)*d*g + 4*3^(1/2)*e* 
f + 3*3^(1/2)*d*h - 2*3^(1/2)*e*h - 2*3^(1/2)*f*g - 3*3^(1/2)*f*h + 3^(1/2 
)*g*h + d*f*x*9i + e*f*x*6i + d*h*x*3i - e*h*x*6i - f*g*x*3i - f*h*x*3i + 
g*h*x*3i - 3*3^(1/2)*f^2*x + 3*3^(1/2)*d*f*x - 2*3^(1/2)*d*g*x - 2*3^(1/2) 
*e*f*x - 3*3^(1/2)*d*h*x - 2*3^(1/2)*e*h*x + 3^(1/2)*f*g*x + 3*3^(1/2)*f*h 
*x + 3^(1/2)*g*h*x + 4*3^(1/2)*d*e*x)*(d/4 - f/4 - g/4 + (3^(1/2)*d*1i)/12 
 + (3^(1/2)*e*1i)/6 + (3^(1/2)*f*1i)/12 - (3^(1/2)*g*1i)/12 - (3^(1/2)*h*1 
i)/6) + log(d*f*9i - d*e*6i + d*g*3i - d*h*3i + e*h*6i + f*h*3i - g*h*3i + 
 3*3^(1/2)*d^2 - d^2*x*6i - f^2*x*3i - d^2*3i - f^2*6i - 2*3^(1/2)*d*e - 3 
*3^(1/2)*d*f + 3^(1/2)*d*g + 4*3^(1/2)*e*f - 3*3^(1/2)*d*h - 2*3^(1/2)*...